import { useState } from 'react'
function PlantInfo2(props) {
    const [showActivities, setShowActivities] = useState(false)
    return <>
        <h1>{props.name}</h1>
        <p>{props.description}</p>
        {showActivities ? props.activities.length > 0 ?
            <ul>
                {
                    props.activities.map((item, index) => {
                        return <li key={index}>{item}</li>
                    })
                }
            </ul> : '暂时没有推荐的活动' : null}
        <button onClick={() => setShowActivities(!showActivities)}>
            {showActivities ? '隐藏活动' : '显示活动'}
        </button>
    </>
}

export default PlantInfo2;